import math


def generate_data():
    """生成201条数据"""
    data = []
    for i in range(1, 202):
        entry = f"xiaoming{i}   xiaoming{i}@china.com   pwd{i}"
        data.append(entry)
    return data


def display_page(data, page):
    """显示指定页码的数据"""
    page_size = 10  # 每页显示10条数据
    total_items = len(data)
    total_pages = math.ceil(total_items / page_size)

    if page < 1 or page > total_pages:
        print(f"无效的页码！总共有 {total_pages} 页。")
        return

    start_index = (page - 1) * page_size
    end_index = start_index + page_size
    page_data = data[start_index:end_index]

    print(f"\n第 {page} 页，共 {total_pages} 页，每页显示 {page_size} 条数据：")
    for entry in page_data:
        print(entry)


def main():
    # 生成数据
    data = generate_data()

    # 提示用户输入页码
    while True:
        try:
            page = int(input("请输入页码（输入0退出）："))
            if page == 0:
                print("程序已退出。")
                break
            display_page(data, page)
        except ValueError:
            print("请输入有效的数字页码！")


if __name__ == "__main__":
    main()